package com.lxj.xianyu;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class Scheduler implements InitializingBean {

    @Autowired
    SpiderService spiderService;

    @Scheduled(cron = "0 */1 * * * ?")
    public void execute() {
        spiderService.execute();
    }

    @Override
    public void afterPropertiesSet() {
        this.execute();
    }

}
